package com.dailyblue.java.spring.boot.redis.controller;

import com.dailyblue.java.spring.boot.redis.service.EmpService;
import com.dailyblue.java.spring.boot.redis.util.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/emp")
@Slf4j
public class EmpController {
    @Resource
    private EmpService empService;
    @GetMapping
    public JsonResult find(){
        return empService.find();
    }
    @GetMapping("/{page}")
    public JsonResult find(@PathVariable("page") int page){
        return empService.find(page);
    }
    @DeleteMapping
    public JsonResult delete(int id){
        log.info("id:{}",id);
        return empService.delete(id);
    }
}
